package project2.entity.bullet;

import project2.config.Config;
import project2.config.ImageConstants;
import project2.entity.Flyable;
import project2.resources.Images;
import project2.type.BulletType;
import project2.ui.game.GamePlayingPanel;

/**
 * 子弹
 */
public class Bullet extends Flyable {
    private BulletType bulletType;// 类型

    public Bullet(GamePlayingPanel gamePlayingPanel, BulletType bulletType) {
        setPlayingPanel(gamePlayingPanel);
        this.bulletType = bulletType;
        switch (this.bulletType) {
            case YELLOW_BULLET:
                setImage(Images.YELLOW_BULLET_IMG);
                setWidth(ImageConstants.YELLOW_BULLET_WIDTH);
                setHeight(ImageConstants.YELLOW_BULLET_HEIGHT);
                setSpeed(Config.YELLOW_BULLET_MOVE_SPEED);
                break;
            case BLUE_BULLET:
                setImage(Images.BLUE_BULLET_IMG);
                setWidth(ImageConstants.BLUE_BULLET_WIDTH);
                setHeight(ImageConstants.BLUE_BULLET_HEIGHT);
                setSpeed(Config.BLUE_BULLET_MOVE_SPEED);
                break;
        }
    }

    public BulletType getBulletType() {
        return bulletType;
    }

    public void setBulletType(BulletType bulletType) {
        this.bulletType = bulletType;
    }

}
